<template>
  <div class="mineContainer">
    <header>
      <div class="avatar">
        <img src="@/assets/mzLogo.png" ref="headIcon" alt="" />
      </div>
      <div class="goLogin" @click="goWhere('/login')">{{ nickName }}</div>
    </header>
    <div class="nav">
      <ul>
        <li>
          <a href="#">
            <van-icon name="label-o" />
            <p>电影订单</p>
          </a>
        </li>
        <li>
          <a href="#">
            <van-icon name="bill-o" class="secI" />
            <p>商品订单</p>
          </a>
        </li>
      </ul>
    </div>
    <div class="mainContent">
      <div class="mainItem">
        <div class="leftBox">
          <div>
            <van-icon name="balance-pay" />
          </div>
          <span>卖座券</span>
        </div>
        <span><van-icon name="arrow" /></span>
      </div>
      <div class="mainItem">
        <div class="leftBox">
          <div>
            <van-icon name="pending-payment" />
          </div>
          <span>组合红包</span>
        </div>
        <span><van-icon name="arrow" /></span>
      </div>
      <div class="mainItem">
        <div class="leftBox">
          <div>
            <van-icon name="balance-o" />
          </div>
          <span>余额</span>
        </div>
        <span><van-icon name="arrow" /></span>
      </div>
      <div class="mainItem" @click="goWhere('/setting')">
        <div class="leftBox">
          <div>
            <van-icon name="setting-o" />
          </div>
          <span>设置</span>
        </div>
        <span><van-icon name="arrow" /></span>
      </div>
    </div>
  </div>
</template>
<script>
import { Icon } from "vant";
import vue from "vue";
vue.use(Icon);
import { mapState } from "vuex";
export default {
  data() {
    return {
      nickName: "立即登录",
    };
  },
  methods: {
    goWhere(path) {
      this.$router.push(path);
    },
  },
  mounted() {
    if (sessionStorage.getItem("token")) {
      this.$refs.headIcon.src = sessionStorage.getItem("headIcon");
      this.nickName = sessionStorage.getItem("nickName");
    }
  },
  computed: {
    ...mapState("userInfoModule", ["userInfo"]),
  },
};
</script>
<style scoped lang='scss'>
.mineContainer {
  background-color: #f4f4f4;
  height: 100%;
  header {
    height: 140px;
    background: url("../assets/loginBG.png") no-repeat center center;
    background-size: 100% 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding-top: 20px;
    .avatar {
      height: 70px;
      width: 70px;
      border-radius: 50%;
      margin: 0 30px;
      overflow: hidden;
      border: 2px solid #fff;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .goLogin {
      color: #fff;
    }
  }
  .nav {
    background-color: #fff;
    ul {
      height: 100px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      li {
        text-align: center;
        width: 50%;
        a {
          color: #aaa;
          text-decoration: none;
          i {
            font-size: 30px;
            color: #ffc82f;
          }
          .secI {
            color: #c6da5c;
          }
          p {
            font-size: 14px;
          }
        }
      }
    }
  }
  .mainContent {
    margin-top: 16px;
    background-color: #fff;
    .mainItem {
      padding: 0 20px;
      border-bottom: 1px solid #eee;
      color: #222;
      display: flex;
      justify-content: space-between;
      align-items: center;
      height: 40px;
      line-height: 40px;
      .leftBox {
        line-height: 40px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        div {
          padding-top: 10px;
          margin-right: 10px;
          i {
            font-size: 22px;
          }
        }
        span {
          color: #222;
        }
      }
      span {
        color: #aaa;
      }
    }
  }
}
</style>